﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Fluent="clr-namespace:Fluent"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">
  <ControlTemplate x:Key="TextBoxControlTemplate" TargetType="{x:Type TextBox}">
    <Border Name="Border" CornerRadius="0" Padding="{TemplateBinding Padding}"
            Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
            BorderThickness="{TemplateBinding BorderThickness}">
      <ScrollViewer Margin="0" x:Name="PART_ContentHost" />
    </Border>

  </ControlTemplate>

  <ContextMenu x:Key="TextBoxContextMenu" x:Shared="False">
    <ContextMenu.Resources>
      <BitmapImage x:Key="MenuCutIcon"
                   UriSource="pack://application:,,,/Fluent;component/Themes\Office2010\Images\Cut.png" PresentationOptions:Freeze="True" />
      <BitmapImage x:Key="MenuCopyIcon"
                   UriSource="pack://application:,,,/Fluent;component/Themes\Office2010\Images\Copy.png" PresentationOptions:Freeze="True" />
      <BitmapImage x:Key="MenuPasteIcon"
                   UriSource="pack://application:,,,/Fluent;component/Themes\Office2010\Images\Paste.png"
                   PresentationOptions:Freeze="True" />
    </ContextMenu.Resources>
    <Fluent:MenuItem Icon="{StaticResource MenuCutIcon}" Command="ApplicationCommands.Cut"
                     CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
    <Fluent:MenuItem Icon="{StaticResource MenuCopyIcon}" Command="ApplicationCommands.Copy"
                     CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
    <Fluent:MenuItem Icon="{StaticResource MenuPasteIcon}" Command="ApplicationCommands.Paste"
                     CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
  </ContextMenu>

  <Style TargetType="{x:Type TextBox}">
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxDisabledBorderBrush}" />
        <Setter Property="Background" Value="{DynamicResource TextBoxDisabledBackgroundBrush}" />
        <Setter Property="Foreground" Value="#FFA0A0A0" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" Value="{DynamicResource TextBoxHoverBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxHoverBorderBrush}" />
      </Trigger>
    </Style.Triggers>
    <Setter Property="Background" Value="{DynamicResource TextBoxBackgroundBrush}" />
    <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" />
    <Setter Property="Template" Value="{DynamicResource TextBoxControlTemplate}" />
    <Setter Property="Foreground" Value="#FF52002D" />
    <Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
  </Style>

</ResourceDictionary>